﻿<baseview:BaseView xmlns:my="clr-namespace:CharacterCreation.Views"  x:Class="CharacterCreation.Views.CharacterNewStatisticsView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:converter="clr-namespace:CharacterCreation.Views.ChildWindows.New_character"
    xmlns:baseview="clr-namespace:CharacterCreation.Views.Contracts"             
    mc:Ignorable="d"
    d:DesignHeight="400" d:DesignWidth="600">

    <baseview:BaseView.Resources>

        <converter:StatColorConverter x:Key="colorConverter" />
        <converter:StatStrikethroughConverter x:Key="strikethroughConverter" />

        <DataTemplate x:Key="itemtemplate">
            <Grid Width="60" HorizontalAlignment="Center">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <TextBlock Text="{Binding}" Foreground="{Binding Converter={StaticResource colorConverter}}" Margin="5" FontSize="16" Grid.Column="0"
                           FontFamily="Georgia" HorizontalAlignment="Center" 
                           TextDecorations="{Binding ElementName=chk, Path=IsChecked, Converter={StaticResource strikethroughConverter}}" />
                <CheckBox x:Name="chk" Margin="5" Grid.Column="1" />
            </Grid>
        </DataTemplate>
    </baseview:BaseView.Resources>

    <Grid x:Name="LayoutRoot">

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*" />
            <ColumnDefinition Width="3*" />
        </Grid.ColumnDefinitions>

        <Grid.RowDefinitions>

        </Grid.RowDefinitions>


        <Grid Grid.Column="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition />
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>

            <StackPanel Margin="10,5,10,5" Grid.ColumnSpan="2" Grid.Column="0" Grid.Row="0">
                <TextBlock Text="Rolled statistics" Foreground="{StaticResource backgroundBrush}" FontSize="16" FontWeight="Bold" />
                <TextBlock Text="These statistics are prerolled. Use one of the lists to fill in your statistics. Remember that you can move 5 points 1 to 1, after it will cost 5 to 1." TextWrapping="Wrap" />
            </StackPanel>

            <StackPanel Grid.Column="0" Grid.Row="1" >
                <ListBox ItemsSource="{Binding StatisticsLeft}" ItemTemplate="{StaticResource itemtemplate}" Width="65" HorizontalAlignment="Center" 
                         Margin="10" BorderThickness="0" ScrollViewer.HorizontalScrollBarVisibility="Disabled"/>
                <TextBlock Text="{Binding LeftTotal}" Margin="0" FontSize="16" FontFamily="Georgia" HorizontalAlignment="Center"/>
            </StackPanel>

            <StackPanel Grid.Column="1" Grid.Row="1">
                <ListBox ItemsSource="{Binding StatisticsRight}" ItemTemplate="{StaticResource itemtemplate}" Width="65" HorizontalAlignment="Left" 
                         Margin="10" BorderThickness="0" ScrollViewer.HorizontalScrollBarVisibility="Disabled"/>
                <TextBlock Text="{Binding RightTotal}" Margin="30,0,0,0" FontSize="16" FontFamily="Georgia" HorizontalAlignment="Left" />
            </StackPanel>

            <Button Grid.Row="2" Grid.ColumnSpan="2" Height="24" Command="{Binding ReRollCommand}" HorizontalContentAlignment="Stretch" 
                    VerticalContentAlignment="Stretch">
                <Border Background="White">
                    <TextBlock Text="Reroll" HorizontalAlignment="Center" VerticalAlignment="Center" />
                </Border>
            </Button>
        </Grid>

        <my:CharacterStatisticsView DataContext="{Binding Character}" DisplayMode="Verbose"  Grid.Column="1" Foreground="Black" IsEnabled="True"/>   

    </Grid>
</baseview:BaseView>
